package cn.edu.stu.syllabus.login;

import cn.edu.stu.syllabus.api.TokenApi;
import cn.edu.stu.syllabus.di.qualifier.Remote;
import cn.edu.stu.syllabus.di.scope.FragmentScoped;
import cn.edu.stu.syllabus.repository.token.TokenDataSource;
import cn.edu.stu.syllabus.repository.token.remote.TokenRemoteDataSource;
import cn.edu.stu.syllabus.utils.SchoolRetrofit;
import dagger.Module;
import dagger.Provides;

/**
 * Created by daidaijie on 2017/4/24.
 */

@Module
public class LoginPresenterModule {

    private LoginContract.View mView;

    public LoginPresenterModule(LoginContract.View view) {
        mView = view;
    }

    @Provides
    @FragmentScoped
    LoginContract.View provideView() {
        return mView;
    }

    @Provides
    @FragmentScoped
    TokenApi provideTokenApi() {
        return SchoolRetrofit.getRetrofit().create(TokenApi.class);
    }

    @Provides
    @FragmentScoped
    @Remote
    TokenDataSource provideTokenRemoteDataSource(TokenApi tokenApi) {
        return new TokenRemoteDataSource(tokenApi);
    }

}
